#ifndef DIRECTINPUT_H
#define DIRECTINPUT_H

#include <dinput.h>
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
#include "Sprite.h"

class DirectInput
{
private:
	DirectInput();
	IDirectInput8*			m_pDIObject;		// direct input device
	LPDIRECTINPUTDEVICE8	m_pDIKeyboard;		// device managing keyboard input
	LPDIRECTINPUTDEVICE8	m_pDIMouse;			// device managing mouse input
	char					m_kbBuffer[256];	// captures keyboard input
	bool					m_bKeyDown[256];
	DIMOUSESTATE			m_mouseState;		// captures mouse input

public:
	inline static DirectInput* Ins()
	{
		static DirectInput theInput;
		return &theInput;
	}
	void Init(HWND hWnd, HINSTANCE hInst);
	void PollDevices();
	bool keyDown(unsigned char key);
	bool mouseButtonDown(int button);
	float mouseDX() { return (float)m_mouseState.lX; }
	float mouseDY() { return (float)m_mouseState.lY; }
	~DirectInput();

	bool getKeyDown(unsigned char key) { return m_bKeyDown[key]; }
};


#endif